#define LF(x) (0.2 * x - 0.1)
precision mediump float;
varying vec2 v_uv; 
uniform sampler2D u_texture; 
uniform sampler2D u_texture0; 
uniform sampler2D u_texture1; 
uniform float timer; 

void main()
{	
	vec2 Displacement_offset = texture2D(u_texture0, vec2(v_uv.x, v_uv.y + timer)).rg;
	vec2 Tex_coords_displaced =  v_uv + LF(Displacement_offset);
	vec4 fire_color = texture2D (u_texture, Tex_coords_displaced);
	vec4 AlphaValue = texture2D (u_texture1, v_uv);
	
	float alpha = AlphaValue.r * fire_color.a;
	if (alpha > 0.2)
		gl_FragColor = fire_color * vec4(1.0, 1.0, 1.0, AlphaValue.r);
	else
		discard;
	
 
	
	
}
